#include "lib.h"
#include "rlbet.h"

RouletteBet::RouletteBet(uint8 betID)
{
	m_amount=0;
	m_numNumbers=0;
	m_betID = betID;
	m_macro = false;
}

RouletteBet::RouletteBet(uint8 betID, int32 amount)
{
	m_amount=amount;
	m_numNumbers=0;
	m_betID = betID;
	m_macro = false;
}

uint8
RouletteBet::getNumber(uint8 index)
{
	if (index < numNumbers())
		return m_numbers[index];
	else
		return (uint8)-1;
}

bool8 
RouletteBet::hasNumber(uint8 num)
{
	uint8 i;

	for (i=0; i < m_numNumbers; i++)
		if (num == getNumber(i))
			return true;


	return false;
}

bool8 
RouletteBet::addNumber(uint8 number)
{
	if (m_numNumbers < MAX_NUMBERS)
	{
		m_numbers[m_numNumbers++] = number;
		return true;
	}
	else
		return false;
}

bool8
RouletteBet::addRange(uint8 start, uint8 end, uint8 increment)
{
	if (m_numNumbers + (end - start) / increment + 1 <= MAX_NUMBERS)
	{
		while (start <= end)
		{
			ASSERT(m_numNumbers < MAX_NUMBERS);

			m_numbers[m_numNumbers++] = start;
			start += increment;
		}
		return true;
	}
	else
		return false;
}
